﻿@model DBTramite.BussinesEntities.T_Salida

@{
    ViewBag.Title = "Crear";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <div class="panel panel-primary">
        <div class="panel-heading">Tramitar el Documento</div>
        <table class="table-condensed">
            <tr>
                <td> <b>Doc Respuesta : </b> 
                    @*<div class="editor-label">
                        @Html.LabelFor(model => model.codtipodocumento)
                    </div>*@
                </td>
                <td> 
                    <div class="editor-field">
                        @Html.TextBoxFor(model => model.codtipodocumento,null,new{@class="form-control"})
                        @Html.ValidationMessageFor(model => model.codtipodocumento)
                    </div>
                </td>
                <td><b>Nro Expediente :</b>
                    @*<div class="editor-label">
                        @Html.LabelFor(model => model.nroexpediente)
                    </div>*@
                </td>
                 <td>
                     <div class="editor-field">
                         <input type="text" value="@Model.nroexpediente" class="form-control" disabled="disabled"/>
                         @Html.HiddenFor(model => model.nroexpediente)
                     </div>
                </td>
            </tr>
            
            <tr>
                <td><b>Nro Doc Respuesta :</b>
                    @*<div class="editor-label">
                        @Html.LabelFor(model => model.nrodocsalida)
                    </div>*@
                </td>
                <td>
                    <div class="editor-field">
                        @Html.TextBoxFor(model => model.nrodocsalida,null,new{@class="form-control"})
                        @Html.ValidationMessageFor(model => model.nrodocsalida)
                    </div>
                </td>
                
                <td><b>Nro Documento :</b>
                    @* <div class="editor-label">
                        @Html.LabelFor(model => model.nrodocumento)
                    </div>*@
                </td>
                <td>
                    <div class="editor-field">
                        <input type="text" value="@Model.nrodocumento" class="form-control" disabled="disabled"/>
                        @Html.HiddenFor(model => model.nrodocumento)
                    </div>
                </td>
            </tr>

            <tr>
                <td><b style="color: #000" />Destino :</td>
                <td colspan="3">
                    <input type="hidden" name="destino" id="destino"/>
                    @(Html.Kendo().AutoComplete()
                          .Name("_destino")
                          .DataTextField("nombre")
                          .Placeholder("Seleccionar un Destino...")
                          .MinLength(1)
                          .Filter("startswith") //aca nomas se pone starWish 
                          .HtmlAttributes(new { style = "width:auto" })
                          .DataSource(source =>  {
                                                     source.Read(read => { read.Action("Listar", "Documento"); });
                          })
                          .Events(e => e.Select("selectDestino"))
                          )
                    <script>
                        function selectDestino(e) {
                            var row = this.dataItem(e.item.index());
                            $("#destino").val(row.id_dep);
                            console.log("item=" + row.id_dep);
                        }
                    </script>
            
                </td>
            </tr>
            <tr>
                <td><b>Asunto :</b>
                    @* <div class="editor-label">
                        @Html.LabelFor(model => model.asunto)
                    </div>*@
                </td>
                
                <td colspan="3">
                    @Html.TextBoxFor(model => model.asunto,null,new{@class="form-control"})
                    @Html.ValidationMessageFor(model => model.asunto)
                </td>
            </tr>
            
            <tr>
                <td><b>Fecha Salida :</b>
                </td>
                <td>
                    <input type="date" value="@Model.fechasalida.Value.ToShortDateString()" class="form-control" disabled="disabled"/>
                </td>
                <td><b>Hora de Salida:</b></td>
                <td>
                    <input type="time" value="@Model.fechasalida.Value.ToShortTimeString()" class="form-control" disabled="disabled"/>
                </td>
            </tr>
            <tr>
                <td><b>Visto :</b>
                    @*<div class="editor-label">
                        @Html.LabelFor(model => model.visto)
                    </div>*@
                </td>
                <td colspan="3">
                    @Html.TextAreaFor(model => model.visto,new{@class="form-control"})
                    @Html.ValidationMessageFor(model => model.visto)
                </td>
            </tr>
            <tr>
                <td><b>Con Copia :</b>
                </td>
                <td colspan="3">
                    <div class="editor-field">
                        @Html.TextBoxFor(model => model.ccopia,null,new{@class="form-control"})
                        @Html.ValidationMessageFor(model => model.ccopia)
                    </div>
                </td>
            </tr>
            <tr>
                <td><b>Trámite Interno :</b>
                </td>
                <td colspan="3">
                    <div class="editor-field">
                        @Html.TextBoxFor(model => model.interno,null,new{@class="form-control"})
                        @Html.ValidationMessageFor(model => model.interno)
                    </div>
                </td>
            </tr>

        </table>
        <div class="panel-footer">
            <button type="submit" class="btn btn-danger">Tramitar</button>
        </div>
    </div>
   
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
